#ifndef KMOD_H

#define KMOD_H 1
//为1时为调试模式，输出大量调试信息
#define DEBUG 0

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <stdbool.h>
#include <unistd.h>
#include <termios.h>
#include <signal.h>
#include <sys/uio.h>
#include "include/const.h"

//关闭回显
#define ECHOFLAGS		(ECHO | ECHOE | ECHOK | ECHONL)
#define CMD_NOT_FOUND	-1
#define CMD_ENTER		-2
#define CMD_TWO_LONG	-3
#define CMD_LOCAL		-4
#define PRIV_DELIM		","

//用户权限
char privs[PRIV_CMD_LEN] = {0};
//服务器端套接字
int serv_sock = -1;
//用户权限
int uprivs[PRIV_NUM] = {0};
//是否已经认证
bool authed = false;

int cmd_parse(char *cmd_str);
bool access_auth();
void shell_exec(char *cmd, char *result);
void key_control_c_register();
void client_resource_revoke();
void cmd_rebuild(int cmd, int state, char *str);
bool server_alive_query();
void get_file_rel_name(char *fabspath, char *filename);
bool is_domain_name(char *str);
void send_data(FILE *wfp, char *absfname);
void recv_data(FILE *rfp, char *fname);

#endif/*End of KMOD_H*/
